package com.ljh.bigevent.controller;

import com.ljh.bigevent.pojo.Result;
import com.ljh.bigevent.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/upload")
public class FileUploadController {
    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping
    public Result<String> upload(MultipartFile file) throws IOException {
        return fileUploadService.uploadFile(file);
    }
}